{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "fb3ec242",
   "metadata": {},
   "outputs": [],
   "source": [
    "import mindspore as ms\n",
    "import mindspore.nn as nn\n",
    "from mindspore import ops\n",
    "from mindspore.dataset import GeneratorDataset\n",
    "import numpy as np\n",
    "from mindnlp.engine import Trainer, TrainingArguments\n",
    "from mindnlp.transformers import (\n",
    "    BloomForCausalLM,\n",
    "    BloomConfig,\n",
    "    BloomTokenizerFast,\n",
    ")\n",
    "from mindnlp.peft import LoraConfig, get_peft_model, PeftModel\n",
    "import gc"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "0b1cfa68",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 设置运行模式和设备\n",
    "ms.set_context(mode=ms.PYNATIVE_MODE, device_target=\"Ascend\")\n",
    "\n",
    "# 基本配置\n",
    "MODEL = \"AI-ModelScope/bloom-3b\"\n",
    "TOKENS = 20"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c551af35",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 加载tokenizer和基础模型\n",
    "tokenizer = BloomTokenizerFast.from_pretrained(MODEL, mirror=\"modelscope\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2b2758a9",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.18"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
